package p1000;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main1004字符串统计 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n;
        while ((n = Integer.parseInt(input.nextLine())) != 0) {
            List<String> list = new ArrayList<String>(n);
            int[] ints = new int[n];
            int flag = 0;
            String tmp;
            for (int i = 0; i < n; i++) {
                tmp = input.nextLine();
                int index = list.indexOf(tmp);
                if (index != -1) {
                    ints[index]++;
                } else {
                    ints[flag]++;
                    flag++;
                    list.add(tmp);
                }
            }

            int max = 0, index = 0;
            for (int i = 0; i < ints.length; i++) {
                if (ints[i] > max) {
                    max = ints[i];
                    index = i;
                }
            }

            System.out.println(list.get(index));
        }
    }
} 